package com.lcu.test;

import com.lcu.bos.dao.IUserDao;
import com.lcu.bos.modle.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:applicationContext.xml")
public class Demo01 {
    //测试Dao
    /**
     * 1.spring 的单元测试加载spring的配置文件
     * 2.配置一个UserDaoImpl的bean  @Repository注解
     */

    //@Autowired
    private IUserDao userDao;
    @Test
    public void test1(){
        User user=new User();
        user.setUsername("大明");
        user.setPassword("132");
        //userDao.save(user);
        List<User> list = userDao.findAll();
        User user1 = userDao.find("402881e770cdb6270170cdb6287f0000");
        System.out.println(user1);
        System.out.println(list);
    }
}
